package cn.iocoder.yudao.module.system.dal.mysql.article;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.system.controller.admin.article.vo.SystemArticlePageReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.article.SystemArticleDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 弹窗文章 Mapper
 *
 * @author admin
 */
@Mapper
public interface SystemArticleMapper extends BaseMapperX<SystemArticleDO> {

    default PageResult<SystemArticleDO> selectPage(SystemArticlePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<SystemArticleDO>()
                .eqIfPresent(SystemArticleDO::getTitle, reqVO.getTitle())
                .eqIfPresent(SystemArticleDO::getStatus, reqVO.getStatus())
                .eqIfPresent(SystemArticleDO::getShowOrder, reqVO.getShowOrder())
                .eqIfPresent(SystemArticleDO::getType, reqVO.getType())
                .eqIfPresent(SystemArticleDO::getContent, reqVO.getContent())
                .eqIfPresent(SystemArticleDO::getPagePath, reqVO.getPagePath())
                .betweenIfPresent(SystemArticleDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(SystemArticleDO::getId));
    }

}